package com.utils;

import com.alibaba.fastjson.JSON;

/**
 * @Author: zrhuang4
 * @CreateTime: 2023-03-15  22:12
 * @Description: TODO
 */

public class SonarIssue {
    static final String URL_GET_ISSUE= "%s/api/issues/search?componentKeys=%s&p=%s&ps=%s";

    public IssueDto RetrieviewIssue(String sonarqube,String user,String passwd,String projectKey,int pageNumber,int pageSize){
        String url = String.format(URL_GET_ISSUE, sonarqube, projectKey,pageNumber,pageSize);
        HttpRequestClient httpRequestClient = new HttpRequestClient(user,passwd);
        String result = httpRequestClient.doGet(url);
        IssueDto jsonRootBean =  JSON.parseObject(result, IssueDto.class);
        return jsonRootBean;
    }

}
